﻿using System;
using Monkey.Framework.Configuration;

namespace Monkey.Framework.Email
{
    public class EmailServiceFactory
    {
        private static IEmailService _emailService;

        //public static void InitializeEmailServiceFactory(IEmailService emailService)
        //{
        //    _emailService = emailService;
        //}

        /// <summary>
        /// Gets the email service.
        /// </summary>
        /// <returns>IEmailService instance</returns>
        public static IEmailService GetEmailService()
        {
            if (_emailService == null)
            {
                switch (ApplicationSettings.EmailServiceName)
                {
                    case "SMTPService":
                        _emailService = new SmtpService();
                        break;

                    default:
                        throw new ApplicationException("Email Service type is not supported!");
                }
            }

            return _emailService;
        }
    }

}
